package dataStream;

import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;
import java.util.List;

/**
 * @desc
 * @Author xuyouchang
 * @Date 2021/10/8
 */
public class MapFuncTest {


    public static void main(String[] args) throws Exception {
        List<String> data = new ArrayList<>();
        data.add("xyc01");
        data.add("xyc02");
        data.add("xyc03");
        data.add("yc01");
        data.add("yc02");

        final StreamExecutionEnvironment env =
                StreamExecutionEnvironment.getExecutionEnvironment();

        DataStream<String> dataStream = env.fromCollection(data);
        DataStream<String> output = dataStream.map(new MapFunction<String, String>() {
            @Override
            public String map(String value) throws Exception {
                return value.concat("_good");
            }
        });


        output.print();
        env.execute();

    }
}
